#include "RquestType.h"
#include "PrintInfo.h"
#include"Server.h"
#include<iostream>
#include"TestULMNN_Manager.hpp"
using namespace std;

extern UserManager user_manager;
extern ChattingRoomManager chat_room_manager;
using UserErr=UserManager::UserErr;
int main(){
    #if LOG
    openlog("chatserver", LOG_PID, LOG_USER);
    #endif
    PRINTF_LOG_AND_DEBUG(LOG_INFO, "Server started.\n");


    // TestULMNN_Manager();
    
    // thread chat_room_cache_cleaner(&ChattingRoomManager::clear_chat_room_cache_func, &chat_room_manager,10);
    thread t(&NotificationManager::SendOrSaveNotify_regularly, NotificationManager::get_instance(),10);
    t.detach();
    thread t2(&ChattingRoomManager::clear_chat_room_cache_func, &chat_room_manager,10);
    t2.detach();

    startServer();

    #if LOG
    closelog();
    #endif
    return 0;
}